# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: manual_thread.py
  @time: 2022/4/25 15:44
  @desc:
"""
from PyQt5.QtCore import *
from backup.manual_testing import manual_testing
from utils.log_util import loggings


class Signal(QObject):
    result_state = pyqtSignal(object)


class ManualThread(QRunnable):
    def __init__(self, die, subdie):
        super().__init__()
        self.signal = Signal()
        self.die = die
        self.subdie = subdie

    def run(self) -> None:
        try:
            manual_testing(self.die, self.subdie)

        except Exception as e:
            loggings.error("LinkCalibrationThread_error" + str(e))
            self.signal.result_state.emit(0)
        else:
            self.signal.result_state.emit(1)
        finally:
            pass
